home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / STANDARD / HTML2 / TABLES.TXT < prev   
Encoding:
Text File  |  1995-11-09  |  66.2 KB  |  1,560 lines

  1.  
  2. HTML Tables                                                      25th Oct 1995
  3.  
  4.    INTERNET DRAFT                                 Dave Raggett, W3C
  5.    Expires in six months                          email: <dsr@w3.org>
  6.  
  7.                                  HTML Tables
  8.  
  9.                        <draft-ietf-html-tables-03.txt>
  10.  
  11. Status of this Memo
  12.  
  13.    This document is an Internet draft. Internet drafts are working
  14.    documents of the Internet Engineering Task Force (IETF), its areas
  15.    and its working groups. Note that other groups may also distribute
  16.    working information as Internet drafts. 
  17.  
  18.    Internet Drafts are draft documents valid for a maximum of six
  19.    months and can be updated, replaced or obsoleted by other documents
  20.    at any time. It is inappropriate to use Internet drafts as reference
  21.    material or to cite them as other than as "work in progress". 
  22.  
  23.    To learn the current status of any Internet draft please check the
  24.    "lid-abstracts.txt" listing contained in the Internet drafts shadow
  25.    directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
  26.    munnari.oz.au (Pacific Rim), ds.internic.net (US East coast) or
  27.    ftp.isi.edu (US West coast). Further information about the IETF can
  28.    be found at URL: http://www.ietf.org/ 
  29.  
  30.    Distribution of this document is unlimited. Please send comments to
  31.    the HTML working group (HTML-WG) of the Internet Engineering Task
  32.    Force (IETF) at <html-wg@oclc.org>. Discussions of this group are
  33.    archived at URL:  http://www.acl.lanl.gov/HTML-WG/archives.html. 
  34.  
  35.    This specification is also available via the Web in hypertext form
  36.    as a Working Draft of the World Wide Web Consortium, see:
  37.    http://www.w3.org/pub/WWW/TR/Overview.html 
  38.  
  39. Abstract
  40.  
  41.    The HyperText Markup Language (HTML) is a simple markup language
  42.    used to create hypertext documents that are portable from one
  43.    platform to another. HTML documents are SGML documents with generic
  44.    semantics that are appropriate for representing information from a
  45.    wide range of applications. This specification extends HTML to
  46.    support a wide variety of tables. The model is designed to work well
  47.    with associated style sheets, but does not require them. It also
  48.    supports rendering to braille, or speech, and exchange of tabular
  49.    data with databases and spreadsheets. The HTML table model embodies
  50.    certain aspects of the CALS table model, e.g. the ability to group
  51.    table rows into thead, tbody and tfoot sections, plus the ability to
  52.    specify cell alignment compactly for sets of cells according to the
  53.    context. 
  54.  
  55. ------------------------------------------------------------------------------
  56.  
  57.  
  58. Dave Raggett                                                            Page 1
  59.  
  60.  
  61.  
  62. HTML Tables                                                      25th Oct 1995
  63.  
  64. Contents
  65.  
  66.    *   Recent Changes  .................................................... 2
  67.  
  68.    *   Brief Introduction  ................................................ 3
  69.  
  70.    *   Design Rationale  .................................................. 5
  71.  
  72.    *   Walkthrough of the Table DTD  ...................................... 7
  73.  
  74.    *   Recommended Layout Algorithms  .................................... 20
  75.  
  76.    *   The Table DTD  .................................................... 23
  77.  
  78.    *   References  ....................................................... 26
  79.  
  80. Recent Changes
  81.  
  82.    This specification extends HTML to support tables. The table model
  83.    has grown out of early work on HTML+ and the initial draft of HTML3.
  84.    The earlier model has been been extended in response to requests
  85.    from information providers for improved control over the
  86.    presentation of tabular information: 
  87.  
  88.    *   alignment on designated characters such as "." and ":"
  89.        e.g. aligning a column of numbers on the decimal point 
  90.  
  91.    *   more flexibility in specifying table frames and rules 
  92.  
  93.    *   incremental display for large tables as data is received 
  94.  
  95.    *   the ability to support scrollable tables with fixed headers plus
  96.        better support for breaking tables across pages for printing 
  97.  
  98.    *   optional column based defaults for alignment properties 
  99.  
  100.    In addition, a major goal has been to provide backwards
  101.    compatibility with the widely deployed Netscape implementation of
  102.    tables. A subsidiary goal has been to simplify importing tables
  103.    conforming to the SGML CALS model. The latest draft makes the ALIGN
  104.    attribute compatible with the latest Netscape and Microsoft
  105.    browsers. Some clarifications have been made to the role of the DIR
  106.    attribute and recommended behaviour when absolute and relative
  107.    column widths are mixed. 
  108.  
  109.    A new element COLGROUP has been introduced to allow sets of columns
  110.    be grouped with different width and alignment properties specified
  111.    by one or more COL elements. The STYLE attribute is defined as a
  112.    means for extending the properties associated with edges and
  113.    interiors of groups of cells. For instance, the line style: dotted,
  114.    double, thin/thick etc; the colour/pattern fill for the interior;
  115.    cell margins and font info. This will be the subject for a companion
  116.    specification on style sheets. 
  117.  
  118. Dave Raggett                                                            Page 2
  119.  
  120.  
  121.  
  122. HTML Tables                                                      25th Oct 1995
  123.  
  124.    The FRAME and RULES attributes have been modified to avoid SGML name
  125.    clashes with each other, and to avoid clashes with the ALIGN and
  126.    VALIGN attributes. These changes are chosen to avoid future problems
  127.    if this specification is extended to allow FRAME and RULES
  128.    attributes with other table elements. 
  129.  
  130. ------------------------------------------------------------------------------
  131. A Brief Introduction to HTML Tables
  132.  
  133.    Tables start with an optional caption followed by one or more rows.
  134.    Each row is formed by one or more cells, which are differentiated
  135.    into header and data cells. Cells can be merged across rows and
  136.    columns, and include attributes assisting rendering to speech and
  137.    braille, or for exporting table data into databases. The model
  138.    provides limited support for control over appearence, for example
  139.    horizontal and vertical alignment of cell contents, border styles
  140.    and cell margins. You can further affect this by grouping rows and
  141.    columns together. Tables can contain a wide range of content, such
  142.    as headers, lists, paragraphs, forms, figures, preformatted text and
  143.    even nested tables. 
  144.  
  145. Example
  146.  
  147.    <TABLE BORDER>
  148.      <CAPTION>A test table with merged cells</CAPTION>
  149.      <TR><TH ROWSPAN=2><TH COLSPAN=2>Average
  150.          <TH ROWSPAN=2>other<BR>category<TH>Misc
  151.      <TR><TH>height<TH>weight
  152.      <TR><TH ALIGN=LEFT>males<TD>1.9<TD>0.003
  153.      <TR><TH ALIGN=LEFT ROWSPAN=2>females<TD>1.7<TD>0.002
  154.    </TABLE>
  155.  
  156.    On a dumb terminal, this would be rendered something like: 
  157.  
  158.                  A test table with merged cells
  159.        /--------------------------------------------------\
  160.        |          |      Average      |  other   |  Misc  |
  161.        |          |-------------------| category |--------|
  162.        |          |  height |  weight |          |        |
  163.        |-----------------------------------------|--------|
  164.        | males    | 1.9     | 0.003   |          |        |
  165.        |-----------------------------------------|--------|
  166.        | females  | 1.7     | 0.002   |          |        |
  167.        \--------------------------------------------------/
  168.    
  169.  
  170.    Next, a richer example with grouped rows and columns (adapted from
  171.    "Developing International Software" by Nadine Kano). First here is
  172.    what the table looks like on paper: 
  173.  
  174.  
  175.  
  176.  
  177.  
  178. Dave Raggett                                                            Page 3
  179.  
  180.  
  181.  
  182. HTML Tables                                                      25th Oct 1995
  183.  
  184.    
  185.                      CODE-PAGE SUPPORT IN MICROSOFT WINDOWS
  186.    ===============================================================================
  187.    Code-Page | Name                         | ACP  OEMCP | Windows Windows Windows
  188.        ID    |                              |            |  NT 3.1 NT 3.51    95
  189.    -------------------------------------------------------------------------------
  190.       1200   | Unicode (BMP of ISO 10646)   |            |    X       X       *
  191.       1250   | Windows 3.1 Eastern European |  X         |    X       X       X
  192.       1251   | Windows 3.1 Cyrillic         |  X         |    X       X       X
  193.       1252   | Windows 3.1 US (ANSI)        |  X         |    X       X       X
  194.       1253   | Windows 3.1 Greek            |  X         |    X       X       X
  195.       1254   | Windows 3.1 Turkish          |  X         |    X       X       X
  196.       1255   | Hebrew                       |  X         |                    X
  197.       1256   | Arabic                       |  X         |                    X
  198.       1257   | Baltic                       |  X         |                    X
  199.       1361   | Korean (Johab)               |  X         |            **      X
  200.    -------------------------------------------------------------------------------
  201.        437   | MS-DOS United States         |        X   |    X       X       X
  202.        708   | Arabic (ASMO 708)            |        X   |                    X
  203.        709   | Arabic (ASMO 449+, BCON V4)  |        X   |                    X
  204.        710   | Arabic (Transparent Arabic)  |        X   |                    X
  205.        720   | Arabic (Transparent ASMO)    |        X   |                    X
  206.    ===============================================================================
  207.    
  208.  
  209.    The markup for this uses COL elements to group columns and set
  210.    column alignment. TBODY elements are used to group rows. The FRAME
  211.    and RULES attributes are used to select which borders to render. 
  212.  
  213.    
  214.    <table border=2 frame=hsides rules=cols>
  215.    <caption>CODE-PAGE SUPPORT IN MICROSOFT WINDOWS</caption>
  216.    <col align=center>
  217.    <col align=left>
  218.    <col align=center span=2>
  219.    <col align=center span=3>
  220.    <thead valign=top>
  221.    <tr>
  222.    <th>Code-Page<br>ID
  223.    <th>Name
  224.    <th>ACP
  225.    <th>OEMCP
  226.    <th>Windows<br>NT 3.1
  227.    <th>Windows<br>NT 3.51
  228.    <th>Windows<br>95
  229.    <tbody>
  230.    <tr><td>1200<td>Unicode (BMP of ISO 10646)<td><td><td>X<td>X<TD>*
  231.    <tr><td>1250<td>Windows 3.1 Eastern European<td>X<td><td>X<td>X<TD>X
  232.    <tr><td>1251<td>Windows 3.1 Cyrillic<td>X<td><td>X<td>X<TD>X
  233.    <tr><td>1252<td>Windows 3.1 US (ANSI)<td>X<td><td>X<td>X<TD>X
  234.    <tr><td>1253<td>Windows 3.1 Greek<td>X<td><td>X<td>X<TD>X
  235.    <tr><td>1254<td>Windows 3.1 Turkish<td>X<td><td>X<td>X<TD>X
  236.    <tr><td>1255<td>Hebrew<td>X<td><td><td><td>X
  237.  
  238. Dave Raggett                                                            Page 4
  239.  
  240.  
  241.  
  242. HTML Tables                                                      25th Oct 1995
  243.  
  244.    <tr><td>1256<td>Arabic<td>X<td><td><td><td>X
  245.    <tr><td>1257<td>Baltic<td>X<td><td><td><td>X
  246.    <tr><td>1361<td>Korean (Johab)<td>X<td><td><td>**<td>X
  247.    <tbody>
  248.    <tr><td>437<td>MS-DOS United States<td><td>X<td>X<td>X<TD>X
  249.    <tr><td>708<td>Arabic (ASMO 708)<td><td>X<td><td><td>X
  250.    <tr><td>709<td>Arabic (ASMO 449+, BCON V4)<td><td>X<td><td><td>X
  251.    <tr><td>710<td>Arabic (Transparent Arabic)<td><td>X<td><td><td>X
  252.    <tr><td>720<td>Arabic (Transparent ASMO)<td><td>X<td><td><td>X
  253.    </table>
  254.    
  255.  
  256. ------------------------------------------------------------------------------
  257. Design Rationale
  258.  
  259.    The HTML table model has evolved from studies of existing SGML
  260.    tables models, the treatment of tables in common word processing
  261.    packages, and looking at a wide range of tabular layout in
  262.    magazines, books and other paper-based documents. The model was
  263.    chosen to allow simple tables to be expressed simply with extra
  264.    complexity only when needed. This makes it practical to create the
  265.    markup for HTML tables with everyday text editors and reduces the
  266.    learning curve for getting started. This feature has been very
  267.    important to the success of HTML to date. 
  268.  
  269.    Increasingly people are using filters from other document formats or
  270.    direct wysiwyg editors for HTML. It is important that the HTML table
  271.    model fits well with these routes for authoring HTML. This affects
  272.    how the representation handles cells which span multiple rows or
  273.    columns, and how alignment and other presentation properties are
  274.    associated with groups of cells. 
  275.  
  276.    A major consideration for the HTML table model is that the fonts and
  277.    window sizes etc. in use with browsers are not under the author's
  278.    control. This makes it risky to rely on column widths specified in
  279.    terms of absolute units such as picas or pixels. Instead, tables can
  280.    be dynamically sized to match the current window size and fonts.
  281.    Authors can provide guidance as to the relative widths of columns,
  282.    but user agents should to ensure that columns are wide enough to
  283.    avoid clipping cell contents. 
  284.  
  285.    For large tables or slow network connections, it is desirable to be
  286.    able to start displaying the table before all of the data has been
  287.    received. The default window width for most user agents shows about
  288.    80 characters, and the graphics for many HTML pages are designed
  289.    with these defaults in mind. Authors can provide a hint to user
  290.    agents to activate incremental display of table contents. This
  291.    feature requires the author to specify the number of columns, and
  292.    includes provision for control of table width and the relative
  293.    widths of different columns. 
  294.  
  295.  
  296.  
  297.  
  298. Dave Raggett                                                            Page 5
  299.  
  300.  
  301.  
  302. HTML Tables                                                      25th Oct 1995
  303.  
  304.    For incremental display, the browser needs the number of columns and
  305.    their widths. The default width of the table is the current window
  306.    size (width="100%"). This can be altered by including a WIDTH
  307.    attribute in the TABLE start tag. By default all columns have the
  308.    same width, but you can specify column widths with one or more COL
  309.    elements before the table data starts. 
  310.  
  311.    The remaining issue is the number of columns. Some people have
  312.    suggested waiting until the first row of the table has been
  313.    received, but this could take a long time if the cells have a lot of
  314.    content. On the whole it makes more sense, when incremental display
  315.    is desired, to get authors to explicitly specify the number of
  316.    columns in the TABLE start tag. 
  317.  
  318.    Authors still need a way of informing the browser whether to use
  319.    incremental display or to automatically size the table to match the
  320.    cell contents. For the two pass auto sizing mode, the number of
  321.    columns is determined by the first pass, while for the incremental
  322.    mode, the number of columns needs to be stated up front. So it seems
  323.    to that COLS=_nn_ would be better for this purpose than a LAYOUT
  324.    attribute such as LAYOUT=FIXED or LAYOUT=AUTO. 
  325.  
  326.    It is generally held useful to consider documents from two
  327.    perspectives: Structural idioms such as headers, paragraphs, lists,
  328.    tables, and figures; and rendering idioms such as margins, leading,
  329.    font names and sizes. The wisdom of past experience encourages us to
  330.    separate the structural information in documents from rendering
  331.    information. Mixing them together ends up causing increased cost of
  332.    ownership for maintaining documents, and reduced portability between
  333.    applications and media. 
  334.  
  335.    For tables, the alignment of text within table cells, and the
  336.    borders between cells are, from the purist's point of view,
  337.    rendering information. In practice, though, it is useful to group
  338.    these with the structural information, as these features are highly
  339.    portable from one application to the next. The HTML table model
  340.    leaves most rendering information to associated style sheets. The
  341.    model is designed to take advantage of such style sheets but not to
  342.    require them. 
  343.  
  344.    This specification provides a superset of the simpler model
  345.    presented in earlier work on HTML+. Tables are considered as being
  346.    formed from an optional caption together with a sequence of rows,
  347.    which in turn consist of a sequence of table cells. The model
  348.    further differentiates header and data cells, and allows cells to
  349.    span multiple rows and columns. 
  350.  
  351.    Following the CALS table model, this specification allows table rows
  352.    to be grouped into head and body and foot sections. This simplifies
  353.    the representation of rendering information and can be used to
  354.    repeat table head and foot rows when breaking tables across page
  355.    boundaries, or to provide fixed headers above a scrollable body
  356.    panel. In the markup, the foot section is placed before the body
  357.  
  358. Dave Raggett                                                            Page 6
  359.  
  360.  
  361.  
  362. HTML Tables                                                      25th Oct 1995
  363.  
  364.    sections. This is an optimization shared with CALS for dealing with
  365.    very long tables. It allows the foot to be rendered without having
  366.    to wait for the entire table to be processed. 
  367.  
  368.    For the visually impaired, HTML offers the hope of setting to rights
  369.    the damage caused by the adoption of windows based graphical user
  370.    interfaces. The HTML table model includes attributes for labeling
  371.    each cell, to support high quality text to speech conversion. The
  372.    same attributes can also be used to support automated import and
  373.    export of table data to databases or spreadsheets. 
  374.  
  375.    Current desktop publishing packages provide very rich control over
  376.    the rendering of tables, and it would be impractical to reproduce
  377.    this in HTML, without making HTML into a bulky rich text format like
  378.    RTF or MIF. This specification does, however, offer authors the
  379.    ability to choose from a set of commonly used classes of border
  380.    styles. The FRAME attribute controls the appearence of the border
  381.    frame around the table while the RULES attribute determines the
  382.    choice of rulings within the table. A finer level of control will be
  383.    supported via rendering annotations. The STYLE attribute can be used
  384.    for including rendering information with individual elements.
  385.    Further rendering information can be given with the STYLE element in
  386.    the document head or via linked style sheets. 
  387.  
  388.    During the development of this specification, a number of avenues
  389.    were investigated for specifying the ruling patterns for tables. One
  390.    issue concerns the kinds of statements that can be made. Including
  391.    support for edge subtraction as well as edge addition leads to
  392.    relatively complex algorithms. For instance work on allowing the
  393.    full set of table elements to include the FRAME and RULES attributes
  394.    led to an algorithm involving some 24 steps to determine whether a
  395.    particular edge of a cell should be ruled or not. Even this
  396.    additional complexity doesn't provide enough rendering control to
  397.    meet the full range of needs for tables. The current specification
  398.    deliberately sticks to a simple intuitive model, sufficient for most
  399.    purposes. Further experimental work is needed before a more complex
  400.    approach is standardized. 
  401.  
  402. ------------------------------------------------------------------------------
  403. A walk through the table DTD
  404.  
  405.    The table document type definition provides the formal definition of
  406.    the allowed syntax for html tables. The following is an annotated
  407.    listing of the DTD. The complete listing appears at the end of this
  408.    document. 
  409.  
  410.    Note that the TABLE element is a block-like element rather a
  411.    character-level element. As such it is a peer of other HTML
  412.    block-like elements such as paragraphs, lists and headers. 
  413.  
  414.  
  415.  
  416.  
  417.  
  418. Dave Raggett                                                            Page 7
  419.  
  420.  
  421.  
  422. HTML Tables                                                      25th Oct 1995
  423.  
  424. Common Attributes
  425.  
  426.    The following attributes occur in several of the elements and are
  427.    defined here for brevity. In general, all attribute names and values
  428.    in this specification are case insensitive, except where noted
  429.    otherwise. 
  430.  
  431.    
  432.    <!ENTITY % attrs
  433.           "id      ID       #IMPLIED  -- element identifier --
  434.            class   NAMES    #IMPLIED  -- for subclassing elements --
  435.            style   CDATA    #IMPLIED  -- rendering annotation --
  436.            lang    NAME     #IMPLIED  -- as per RFC 1766 --
  437.            dir   (ltr|rtl)  #IMPLIED  -- I18N text direction --">
  438.    
  439.  
  440.    ID 
  441.        Used to define a document-wide identifier. This can be used for
  442.        naming positions within documents as the destination of a
  443.        hypertext link. It may also be used by style sheets for
  444.        rendering an element in a unique style. An ID attribute value is
  445.        an SGML NAME token. NAME tokens are formed by an initial letter
  446.        followed by letters, digits, "-" and "." characters. The letters
  447.        are restricted to A-Z and a-z. 
  448.  
  449.    CLASS 
  450.        A space separated list of SGML NAME tokens. CLASS names specify
  451.        that the element belongs to the corresponding named classes.
  452.        These may be used by style sheets to provide class dependent
  453.        renderings. 
  454.  
  455.    STYLE 
  456.        A text string providing rendering information specific to this
  457.        element. The notation is specified with the STYLE element in the
  458.        document head. The user agent can select an appropriate
  459.        rendering style based on rendering annotations using the STYLE
  460.        attribute of the current element, rendering information in the
  461.        STYLE element in the document head, and linked style sheets. The
  462.        specification of the syntax and semantics for style notations is
  463.        outside the scope of this document. 
  464.  
  465.    LANG 
  466.        A LANG attribute identifies the natural language used by the
  467.        content of the associated element.The syntax and registry of
  468.        language values are defined by RFC 1766. In summary the language
  469.        is given as a primary tag followed by zero or more subtags,
  470.        separated by "-". White space is not allowed and all tags are
  471.        case insensitive. The name space of tags is administered by
  472.        IANA. The two letter primary tag is an ISO 639 language
  473.        abbreviation, while the initial subtag is a two letter ISO 3166
  474.        country code. Example values for LANG include: 
  475.  
  476.              en, en-US, en-uk, i-cherokee, x-pig-latin.
  477.  
  478. Dave Raggett                                                            Page 8
  479.  
  480.  
  481.  
  482. HTML Tables                                                      25th Oct 1995
  483.  
  484.    DIR 
  485.        Human writing systems are grouped into scripts, which determine
  486.        amongst other things, the direction the characters are written.
  487.        Elements of the Latin script are nominally left to right, while
  488.        those of the Arabic script are nominally right to left. These
  489.        characters have what is called strong directionality. Other
  490.        characters can be directionally neutral (spaces) or weak
  491.        (punctuation). 
  492.  
  493.        The DIR attribute specifies an encapsulation boundary which
  494.        governs the interpretation of neutral and weakly directional
  495.        characters. It does not override the directionality of strongly
  496.        directional characters. The DIR attribute value is one of LTR
  497.        for left to right, or RTL for right to left, e.g. DIR=RTL. 
  498.  
  499.        When applied to TABLE, it indicates the geometric layout of rows
  500.        (i.e. row 1 is on right if DIR=RTL, but on the left if DIR=LTR)
  501.        and it indicates a default base directionality for any text in
  502.        the table's content if no other DIR attribute applies to that
  503.        text. 
  504.  
  505. ------------------------------------------------------------------------------
  506. Horizontal and Vertical Alignment Attributes
  507.  
  508.    The alignment of cell contents can be specified on a cell by cell
  509.    basis, or inherited from enclosing elements, such as the row, column
  510.    or the table element itself. 
  511.  
  512.    ALIGN 
  513.        This specifies the horizontal alignment of cell contents. 
  514.  
  515.        <!-- horizontal alignment attributes for cell contents -->
  516.        <!ENTITY % cell.halign
  517.                "align  (left|center|right|justify|char) #IMPLIED
  518.                 char    CDATA   #IMPLIED -- alignment char, e.g. char=':' --
  519.                 charoff NUTOKEN 50       -- % offset for alignment char --"
  520.                >
  521.  
  522.        The attribute value should be one of LEFT, CENTER, RIGHT,
  523.        JUSTIFY and CHAR. User agents may treat JUSTIFY as left
  524.        alignment if they lack support for text justification.
  525.        ALIGN=CHAR is used for aligning cell contents on a particular
  526.        character. 
  527.  
  528.        For cells spanning multiple rows or columns, where the alignment
  529.        property is inherited from the row or column, the initial row
  530.        and column for the cell determines the appropriate alignment
  531.        property to use. 
  532.  
  533.        Note that an alignment attribute on elements within the cell,
  534.        e.g. on a P element, overrides the normal alignment value for
  535.        the cell. 
  536.  
  537.  
  538. Dave Raggett                                                            Page 9
  539.  
  540.  
  541.  
  542. HTML Tables                                                      25th Oct 1995
  543.  
  544.    CHAR 
  545.        This is used to specify an alignment character for use with
  546.        align=char, e.g. char=":". The default character is the decimal
  547.        point for the current language, as set by the LANG attribute.
  548.        The CHAR attribute value is case sensitive. 
  549.  
  550.    CHAROFF 
  551.        Specifies the offset to the first occurrence of the alignment
  552.        character on each line. If a line doesn't include the alignment
  553.        character, it should be horizontally shifted to end at the
  554.        alignment position. The resolved direction of the cell, as
  555.        determined by the inheritance of the DIR attribute, is used to
  556.        set whether the offset is from the left or right margin of the
  557.        cell. For Latin scripts, the offset will be from the left
  558.        margin, while for Arabic scripts, it will be from the right
  559.        margin. In addition to standard units, the "%" sign may be used
  560.        to indicate that the value specifies the alignment position as a
  561.        percentage offset of the current cell, e.g. CHAROFF="30%"
  562.        indicates the alignment character should be positioned 30%
  563.        through the cell. 
  564.  
  565.        In the absence of the CHAROFF attribute, the default alignment
  566.        position when using the two pass layout algorithm can be
  567.        determined by choosing the position that would center lines for
  568.        which the width before and after the alignment character are at
  569.        the maximum values for any of the lines in the column for which
  570.        ALIGN=CHAR. For incremental table layout the suggested default
  571.        is CHAROFF="50%". 
  572.  
  573.        Note that this applies whether the text is displayed left to
  574.        right, or right to left. If several cells in different rows for
  575.        the same column use character alignment, then all such cells
  576.        should line up, regardless of which character is used for
  577.        alignment. 
  578.  
  579.    VALIGN 
  580.        Defines whether the cell contents are aligned with the top,
  581.        middle or bottom of the cell. 
  582.  
  583.        <!-- vertical alignment attributes for cell contents -->
  584.        <!ENTITY % cell.valign
  585.                "valign  (top|middle|bottom|baseline)  #IMPLIED"
  586.                >
  587.  
  588.        If present, the value of the attribute should be one of: TOP,
  589.        MIDDLE, BOTTOM or BASELINE. All cells in the same row with
  590.        valign=baseline should be vertically positioned so that the
  591.        first text line in each such cell occur on a common baseline.
  592.        This constraint does not apply to subsequent text lines in these
  593.        cells. 
  594.  
  595.  
  596.  
  597.  
  598. Dave Raggett                                                           Page 10
  599.  
  600.  
  601.  
  602. HTML Tables                                                      25th Oct 1995
  603.  
  604. Inheritance Order
  605.  
  606.    Alignment properties can be included with most of the table
  607.    elements: COL, THEAD, TBODY, TFOOT, TR, TH and TD. When rendering
  608.    cells, horizontal alignment is determined by columns in preference
  609.    to rows, while for vertical alignment, the rows are more important
  610.    than the columns. The following table gives the detailed precedence
  611.    order for each attribute: 
  612.  
  613.    ALIGN, CHAR and CHAROFF: 
  614.  
  615.     cells < columns < column groups < rows < row groups < default
  616.  
  617.    VALIGN, LANG, DIR and STYLE: 
  618.  
  619.     cells < rows < row groups < columns < column groups < table < default
  620.  
  621.    Where cells are defined by TH and TD elements; rows by TR elements;
  622.    row groups by THEAD, TBODY and TFOOT elements, columns by COL
  623.    elements; and column groups by COLGROUP and COL elements. Note that
  624.    there is no inheritance mechanism for the CLASS attribute. 
  625.  
  626.    Properties defined on cells take precedence over inherited
  627.    properties, but are in turn over-ridden by alignment properties on
  628.    elements within cells. In the absence of an ALIGN attribute along
  629.    the inheritance path, the recommended default alignment for table
  630.    cell contents is ALIGN=LEFT for table data and ALIGN=CENTER for
  631.    table headers. The recommended default for vertical alignment is
  632.    VALIGN=MIDDLE. These defaults are chosen to match the behaviour of
  633.    the widely deployed Netscape implementation. 
  634.  
  635. ------------------------------------------------------------------------------
  636. Standard Units for Widths
  637.  
  638.    Several attributes specify widths as a number followed by an
  639.    optional suffix. The units for widths are specified by the suffix:
  640.    pt denotes points, pi denotes picas, in denotes inches, cm denotes
  641.    centimeters, mm denotes millimeters, em denotes em units (equal to
  642.    the height of the default font), and px denotes screen pixels. The
  643.    default units are screen pixels (chosen for backwards
  644.    compatibility). The number is an integer value or a real valued
  645.    number such as "2.5". Exponents, as in "1.2e2", are not allowed.
  646.    White space is not allowed between the number and the suffix. 
  647.  
  648.    The above set of suffices is augmented for certain elements: "%" is
  649.    used for the WIDTH attribute for the TABLE element. It indicates
  650.    that the attribute specifies the percentage width of the space
  651.    between the current left and right margins, e.g. width="50%". For
  652.    the COL element, "*" is used with the the WIDTH attribute to specify
  653.    relative column widths, e.g. width="3*", using the same
  654.    representation as the CALS table model. 
  655.  
  656. ------------------------------------------------------------------------------
  657.  
  658. Dave Raggett                                                           Page 11
  659.  
  660.  
  661.  
  662. HTML Tables                                                      25th Oct 1995
  663.  
  664. The TABLE element
  665.  
  666.    
  667.    <!ENTITY % Where "(left|center|right)">
  668.    
  669.    <!ELEMENT table - - (caption?, (col|colgroup)*, thead?, tfoot?, tbody+)>
  670.    
  671.    <!ATTLIST table                    -- table element --
  672.            %attrs;                    -- id, lang, style, dir and class --
  673.            align   %Where;  #IMPLIED  -- table position relative to window --
  674.            width   CDATA    #IMPLIED  -- table width relative to window --
  675.            cols    NUMBER   #IMPLIED  -- used for immediate display mode --
  676.            border  CDATA    #IMPLIED  -- controls frame width around table --
  677.            frame   %Frame;  #IMPLIED  -- which parts of table frame to include --
  678.            rules   %Rules;  #IMPLIED  -- controls rules between cells --
  679.            cellspacing CDATA #IMPLIED -- spacing between cells --
  680.            cellpadding CDATA #IMPLIED -- spacing within cells --
  681.            >
  682.  
  683.    The TABLE element requires both start and end tags. Table elements
  684.    start with an optional CAPTION element, optionally followed by one
  685.    or more COL or COLGROUP elements, then an optional THEAD, an
  686.    optional TFOOT, and finally one or more TBODY elements. 
  687.  
  688. ------------------------------------------------------------------------------
  689.    ID, CLASS, STYLE, LANG and DIR 
  690.        See earlier description of common attributes. 
  691.  
  692.    ALIGN 
  693.        Defines the horizontal position of the table relative to the
  694.        current left and right margins. ALIGN=CENTER centers the table
  695.        midway between the left and right margins. To allow text to flow
  696.        around the table, use ALIGN=LEFT to position the table at the
  697.        left margin, with text flowing around its right handside, or use
  698.        ALIGN=RIGHT to position the table at the right margin, with text
  699.        flowing around its left handside. 
  700.  
  701.        Note use <BR CLEAR=LEFT> after the table element if you want to
  702.        avoid text flowing along side the table when you have specified
  703.        ALIGN=LEFT, or <BR CLEAR=RIGHT> for a right aligned table. 
  704.  
  705.    WIDTH 
  706.        Specifies the desired width of the table. In addition to the
  707.        standard units, the "%" sign may used to indicate that the width
  708.        specifies the percentage width of the space between the current
  709.        left and right margins, e.g. width="50%". 
  710.  
  711.        It is recommended that the table width be increased beyond the
  712.        value indicated by the WIDTH attribute as needed to avoid
  713.        clipping of cell contents. In the absence of this attribute, the
  714.        table width can be determined by the layout algorithm given
  715.        later on. 
  716.  
  717.  
  718. Dave Raggett                                                           Page 12
  719.  
  720.  
  721.  
  722. HTML Tables                                                      25th Oct 1995
  723.  
  724.    COLS 
  725.        Specifies the number of columns for the table. If present the
  726.        user agent may render the table dynamically as data is received
  727.        from the network without waiting for the complete table to be
  728.        received. If the WIDTH attribute is missing, a default of "100%"
  729.        may be assumed for this purpose. If the COLS attribute is
  730.        absent, a prepass through the table's contents is needed to
  731.        determine the number of columns together with suitable values
  732.        for the widths of each column. 
  733.  
  734.    BORDER 
  735.        Specifies the width of the border framing the table, see
  736.        standard units. 
  737.  
  738.    FRAME 
  739.        Specifies which sides of the frame to render. 
  740.  
  741.        <!ENTITY % Frame
  742.           "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
  743.  
  744.        VOID
  745.            Don't render any sides of the frame. 
  746.  
  747.        ABOVE
  748.            The top side of the frame 
  749.  
  750.        BELOW
  751.            The bottom side of the frame 
  752.  
  753.        HSIDES
  754.            The top and bottom sides of the frame 
  755.  
  756.        LHS
  757.            The left hand side of the frame 
  758.  
  759.        RHS
  760.            The right hand side of the frame 
  761.  
  762.        VSIDES
  763.            The left and right sides of the frame 
  764.  
  765.        BOX
  766.            All four sides of the frame 
  767.  
  768.        BORDER
  769.            All four sides of the frame 
  770.  
  771.        The value "Border" is included for backwards compatibility with
  772.        deployed browsers. If a document includes <TABLE BORDER> the
  773.        user agent will see FRAME=BORDER and BORDER=_implied_. If the
  774.        document includes <TABLE BORDER=_n_> then the user agent should
  775.        treat this as FRAME=BORDER except if _n=0_ for which FRAME=VOID
  776.        is appropriate. 
  777.  
  778. Dave Raggett                                                           Page 13
  779.  
  780.  
  781.  
  782. HTML Tables                                                      25th Oct 1995
  783.  
  784.    RULES 
  785.        Specifies where to draw rules within the table interior. The
  786.        values have been chosen to avoid an SGML NAME clash with the
  787.        FRAME attribute. 
  788.  
  789.        <!ENTITY % Rules "(none | basic | rows | cols | all)">
  790.  
  791.        NONE 
  792.            Suppresses internal rulings. 
  793.  
  794.        BASIC 
  795.            The THEAD, TFOOT and TBODY elements divide the table into
  796.            groups of rows. This choice places a horizontal rule between
  797.            each such group. 
  798.  
  799.        ROWS 
  800.            Place horizontal rules between all rows. User agents may
  801.            choose to use a heavier rule between groups of rows for
  802.            emphasis. 
  803.  
  804.        COLS 
  805.            Place vertical rules between groups of columns as defined by
  806.            COLSET and COL elements, plus horizontal rules between row
  807.            groups (see rules=basic). 
  808.  
  809.        ALL 
  810.            Place rules between all rows and all columns. User agents
  811.            may choose to use a heavier rule between groups of rows and
  812.            columns for emphasis. 
  813.  
  814.        If a document includes <TABLE BORDER> or <TABLE BORDER=_n_> then
  815.        the default for the table element is RULES=ALL, except if _n=0_
  816.        for which RULES=NONE is appropriate. 
  817.  
  818.    CELLSPACING 
  819.        Specifies the space between individual cells in a table. See
  820.        standard units. 
  821.  
  822.    CELLPADDING 
  823.        Specifies the amount of space between the border of the cell and
  824.        its contents. See standard units. 
  825.  
  826. ------------------------------------------------------------------------------
  827. Table Captions
  828.  
  829.    <!ELEMENT caption - - (%text;)+>
  830.    
  831.    <!ENTITY % Caption "(top|bottom|left|right)">
  832.    
  833.    <!ATTLIST caption                  -- table caption --
  834.            %attrs;                    -- id, lang, style, dir and class --
  835.            align   %Caption; #IMPLIED -- relative to table --
  836.            >
  837.  
  838. Dave Raggett                                                           Page 14
  839.  
  840.  
  841.  
  842. HTML Tables                                                      25th Oct 1995
  843.  
  844.    The optional CAPTION element is used to provide a caption for the
  845.    table. Both start and end tags are required. 
  846.  
  847.    ID, CLASS, STYLE, LANG and DIR 
  848.        See earlier description of common attributes. 
  849.  
  850.    ALIGN 
  851.        This may be used to control the placement of captions relative
  852.        to the table. When present, the ALIGN attribute should have one
  853.        of the values: TOP, BOTTOM, LEFT and RIGHT. It is recommended
  854.        that the caption is made to fit within the width or height of
  855.        the table as appropriate. The default position of the caption is
  856.        deliberately unspecified. 
  857.  
  858.        _The ALIGN attribute is overused in HTML, but is retained here
  859.        for compatibility with currently deployed browsers._ 
  860.  
  861. ------------------------------------------------------------------------------
  862. The COLGROUP Element
  863.  
  864.    <!ELEMENT colgroup - O (col+)>
  865.    
  866.     <!ATTLIST colgroup
  867.            %attrs;                    -- id, lang, style, dir and class --
  868.            %cell.halign;              -- horizontal alignment in cells --
  869.            %cell.valign;              -- vertical alignment in cells --
  870.            >
  871.  
  872.    Normally, the COL element defines a group of one or more columns.
  873.    The number of columns in the group is specified by the SPAN
  874.    attribute. If you also want to specify the width for each of the
  875.    columns using the WIDTH attribute, then each of the columns must
  876.    have the same width. 
  877.  
  878.    The COLGROUP element allows you to escape this limitation. It acts
  879.    as a container for one or more COL elements, so you can give each of
  880.    the columns in the group different widths and alignment properties.
  881.    COLGROUP suppresses the normal interpretation of COL elements as
  882.    column groups for any COL elements contained within it. 
  883.  
  884.    COLGROUP requires a start tag, but the end tag may be omitted. This
  885.    is useful when defining a sequence of COLGROUP elements, e.g. 
  886.  
  887.        <TABLE FRAME=ALL RULES=COLS>
  888.          <COLGROUP>
  889.            <COL WIDTH="1*">
  890.            <COL WIDTH="2*">
  891.          <COLGROUP>
  892.            <COL WIDTH="1*">
  893.            <COL WIDTH="3*">
  894.          <THEAD>
  895.            <TR> ...
  896.        </TABLE>
  897.  
  898. Dave Raggett                                                           Page 15
  899.  
  900.  
  901.  
  902. HTML Tables                                                      25th Oct 1995
  903.  
  904.    COLGROUP elements can be used with the following attributes: 
  905.  
  906.    ID, CLASS, STYLE, LANG and DIR 
  907.        See earlier description of common attributes. 
  908.  
  909.    ALIGN, CHAR, CHAROFF and VALIGN 
  910.        Specify values for horizontal and vertical alignment within
  911.        table cells. See inheritance order of alignment properties. 
  912.  
  913. ------------------------------------------------------------------------------
  914. The COL Element
  915.  
  916.    <!ELEMENT col - O EMPTY>
  917.    
  918.    <!ATTLIST col                      -- column groups and properties --
  919.            %attrs;                    -- id, lang, style, dir and class --
  920.            span    NUMBER   1         -- number of columns spanned by group --
  921.            width   CDATA    #IMPLIED  -- relative width e.g. width="2.5*" --
  922.            %cell.halign;              -- horizontal alignment in cells --
  923.            %cell.valign;              -- vertical alignment in cells --
  924.            >
  925.  
  926.    This optional element is used to specify column based defaults for
  927.    table properties. It is an empty element, and as such has no
  928.    content, and shouldn't be given an end tag. Several COL elements may
  929.    be given in succession. 
  930.  
  931.    ID, CLASS, STYLE, LANG and DIR 
  932.        See earlier description of common attributes. 
  933.  
  934.    SPAN 
  935.        A positive integer value that specifies how many columns this
  936.        element applies to, defaulting to one. In the absence of SPAN
  937.        attributes the first COL element applies to the first column,
  938.        the second COL element to the second column and so on. If the
  939.        second COL element had SPAN=2, it would apply to the second and
  940.        third column. The next COL element would then apply to the
  941.        fourth column and so on. SPAN=0 has a special significance and
  942.        implies that the COL element spans all columns from the current
  943.        column up to and including the last column. 
  944.  
  945.    WIDTH 
  946.        Specifies the width of the columns, see standard units. If the
  947.        element spans several columns then the WIDTH attribute specifies
  948.        the width for each of the individual columns - not the width of
  949.        the group. In addition, the "*" suffix denotes relative widths,
  950.        e.g. 
  951.  
  952.             width=64        width in screen pixels
  953.             width=0.5*      a relative width of 0.5
  954.  
  955.        Relative widths act as constraints on the relative widths of
  956.        different columns. If a COL element specifies a relative width
  957.  
  958. Dave Raggett                                                           Page 16
  959.  
  960.  
  961.  
  962. HTML Tables                                                      25th Oct 1995
  963.  
  964.        of zero, the column should always be set to its minimum width.
  965.        When widths are given in absolute units, the user agent can use
  966.        these to constrain the width of the table. The "*" suffix is
  967.        used to simplify importing tables from the CALS representation. 
  968.  
  969.    ALIGN, CHAR, CHAROFF and VALIGN 
  970.        Specify values for horizontal and vertical alignment within
  971.        table cells. See inheritance order of alignment properties. 
  972.  
  973. ------------------------------------------------------------------------------
  974. Table Head, Foot and Body Elements
  975.  
  976.    <!ELEMENT thead - O tr+>
  977.    <!ELEMENT tfoot - O tr+>
  978.    <!ELEMENT tbody O O tr+>
  979.    
  980.    <!ATTLIST (thead|tbody|tfoot)      -- table section --
  981.            %attrs;                    -- id, lang, style, dir and class --
  982.            %cell.halign;              -- horizontal alignment in cells --
  983.            %cell.valign;              -- vertical alignment in cells --
  984.            >
  985.  
  986.    Tables may be divided up into head and body sections. The THEAD and
  987.    TFOOT elements are optional, but one or more TBODY elements are
  988.    always required. If the table only consists of a TBODY section, the
  989.    TBODY start and end tags may be omitted, as the parser can infer
  990.    them. If a THEAD element is present, the THEAD start tag is
  991.    required, but the end tag can be omitted, provided a TFOOT or TBODY
  992.    start tag follows. The same applies to TFOOT. _This definition
  993.    provides compatibility with tables created for the older model, as
  994.    well as allowing the end tags for THEAD, TFOOT and TBODY to be
  995.    omitted._ 
  996.  
  997.    The THEAD, TFOOT and TBODY elements provide a convenient means for
  998.    controlling rendering. If the table has a large number of rows in
  999.    the body, user agents may choose to use a scrolling region for the
  1000.    table body sections. When rendering to a paged device, tables will
  1001.    often have to be broken across page boundaries. The THEAD, TFOOT and
  1002.    TBODY elements allow the user agent to repeat the table foot at the
  1003.    bottom of the current page, and then the table head at the top of
  1004.    the new page before continuing on with the table body. 
  1005.  
  1006.    TFOOT is placed before the TBODY in the markup sequence, so that
  1007.    browsers can render the foot before receiving all of the table data.
  1008.    This is useful when very long tables are rendered with scrolling
  1009.    body sections, or for paged output, involving breaking the table
  1010.    over many pages. 
  1011.  
  1012.    Each THEAD, TFOOT and TBODY element must contain one or more TR
  1013.    elements. 
  1014.  
  1015.    ID, CLASS, STYLE, LANG and DIR 
  1016.        See earlier description of common attributes. 
  1017.  
  1018. Dave Raggett                                                           Page 17
  1019.  
  1020.  
  1021.  
  1022. HTML Tables                                                      25th Oct 1995
  1023.  
  1024.    ALIGN, CHAR, CHAROFF and VALIGN 
  1025.        Specify values for horizontal and vertical alignment within
  1026.        table cells. See inheritance order of alignment properties. 
  1027.  
  1028. ------------------------------------------------------------------------------
  1029. Table Row (TR) elements
  1030.  
  1031.    <!ELEMENT tr - O (th|td)+>
  1032.    
  1033.    <!ATTLIST tr                       -- table row --
  1034.            %attrs;                    -- id, lang, style, dir and class --
  1035.            %cell.halign;              -- horizontal alignment in cells --
  1036.            %cell.valign;              -- vertical alignment in cells --
  1037.            >
  1038.  
  1039.    The TR or table row element acts as a container for a row of table
  1040.    cells. The end tag may be omitted. 
  1041.  
  1042.    ID, CLASS, STYLE, LANG and DIR 
  1043.        See earlier description of common attributes. 
  1044.  
  1045.    ALIGN, CHAR, CHAROFF and VALIGN 
  1046.        Specify values for horizontal and vertical alignment within
  1047.        table cells. See inheritance order of alignment properties. 
  1048.  
  1049. ------------------------------------------------------------------------------
  1050. Table Cells: TH and TD
  1051.  
  1052.    <!ELEMENT (th|td) - O %body.content>
  1053.    
  1054.    <!ATTLIST (th|td)                  -- header or data cell --
  1055.            %attrs;                    -- id, lang, style, dir and class --
  1056.            axis    CDATA    #IMPLIED  -- defaults to cell content --
  1057.            axes    CDATA    #IMPLIED  -- list of axis names --
  1058.            nowrap (nowrap)  #IMPLIED  -- suppress word wrap --
  1059.            rowspan NUMBER   1         -- number of rows spanned by cell --
  1060.            colspan NUMBER   1         -- number of cols spanned by cell --
  1061.            %cell.halign;              -- horizontal alignment in cells --
  1062.            %cell.valign;              -- vertical alignment in cells --
  1063.            >
  1064.  
  1065.    TH elements are used to represent header cells, while TD elements
  1066.    are used to represent data cells. This allows user agents to render
  1067.    header and data cells distinctly, even in the absence of style
  1068.    sheets. 
  1069.  
  1070.    Cells can span multiple rows and columns, and may be empty. Cells
  1071.    spanning rows contribute to the column count on each of the spanned
  1072.    rows, but only appear in the markup once (in the first row spanned).
  1073.    The row count is determined by the number of TR elements. Any rows
  1074.    implied by cells spanning rows beyond this should be ignored. 
  1075.  
  1076.  
  1077.  
  1078. Dave Raggett                                                           Page 18
  1079.  
  1080.  
  1081.  
  1082. HTML Tables                                                      25th Oct 1995
  1083.  
  1084.    If the column count for the table is greater than the number of
  1085.    cells for a given row (after including cells for spanned rows), the
  1086.    missing cells are treated as occurring on the right hand side of the
  1087.    table and rendered as empty cells. If the language context indicates
  1088.    a right to left writing order, then the missing cells should be
  1089.    placed on the left hand side. 
  1090.  
  1091.    It is possible to create tables with overlapping cells, for
  1092.    instance: 
  1093.  
  1094.        <table border>
  1095.        <tr><td rowspan=2>1<td>2<td>3
  1096.        <tr><td rowspan=2>4
  1097.        <tr><td colspan=2>5<td>6
  1098.        </table>
  1099.  
  1100.    which might look something like: 
  1101.  
  1102.        /-----------\
  1103.        | 1 | 2 | 3 | 
  1104.        |   |-------|
  1105.        |   | 4 |   |
  1106.        |---|...|---|
  1107.        | 5 :   | 6 |
  1108.        \-----------/
  1109.  
  1110.    In this example, the cells labelled 4 and 5 overlap. In such cases,
  1111.    the rendering is implementation dependent. 
  1112.  
  1113.    The AXIS and AXES attributes for cells provide a means for defining
  1114.    concise labels for cells. When rendering to speech, these attributes
  1115.    may be used to provide abbreviated names for the headers relevant to
  1116.    each cell. Another application is when you want to be able to later
  1117.    process table contents to enter them into a database. These
  1118.    attributes are then used to give database field names. The table's
  1119.    class attribute should be used to let the software recognize which
  1120.    tables can be treated in this way. 
  1121.  
  1122.    ID, CLASS, STYLE, LANG and DIR 
  1123.        See earlier description of common attributes. 
  1124.  
  1125.    AXIS 
  1126.        This defines an abbreviated name for a header cell, e.g. which
  1127.        can be used when rendering to speech. It defaults to the cell's
  1128.        content. 
  1129.  
  1130.    AXES 
  1131.        This is a comma separated list of axis names which together
  1132.        identify the row and column headers that pertain to this cell.
  1133.        It is used for example when rendering to speech to identify the
  1134.        cell's position in the table. If missing the user agent can try
  1135.        to follow up columns and left along rows (right for some
  1136.        languages) to find the corresponding header cells. 
  1137.  
  1138. Dave Raggett                                                           Page 19
  1139.  
  1140.  
  1141.  
  1142. HTML Tables                                                      25th Oct 1995
  1143.  
  1144.    NOWRAP, e.g. <TD NOWRAP> 
  1145.        The presence of this attribute disables automatic wrapping of
  1146.        text lines for this cell. If used uncautiously, it may result in
  1147.        excessively wide cells. 
  1148.  
  1149.    ROWSPAN, e.g. <TD ROWSPAN=2> 
  1150.        A positive integer value that defines how may rows this cell
  1151.        spans. The default ROWSPAN is 1. ROWSPAN=0 has a special
  1152.        significance and implies that the cell spans all rows from the
  1153.        current row up to the last row of the table. 
  1154.  
  1155.    COLSPAN, e.g. <TD COLSPAN=2> 
  1156.        A positive integer value that defines how may columns this cell
  1157.        spans. The default COLSPAN is 1. COLSPAN=0 has a special
  1158.        significance and implies that the cell spans all columns from
  1159.        the current column up to the last column of the table. 
  1160.  
  1161.    ALIGN, CHAR, CHAROFF and VALIGN 
  1162.        Specify values for horizontal and vertical alignment within
  1163.        table cells. See inheritance order of alignment properties. 
  1164.  
  1165.    Note: It is recommended that implementors provide support for the
  1166.    Netscape 1.1 WIDTH attribute for TH and TD, although this isn't part
  1167.    of the current specification. Document authors are advised to use
  1168.    the width attribute for the COL element instead. 
  1169.  
  1170. ------------------------------------------------------------------------------
  1171. Recommended Layout Algorithms
  1172.  
  1173.    If the COLS attribute on the TABLE element specifies the number of
  1174.    columns, then the table may be rendered using a fixed layout,
  1175.    otherwise the autolayout algorithm described below should be used. 
  1176.  
  1177. Fixed Layout Algorithm
  1178.  
  1179.    For this algorithm, it is assumed that the number of columns is
  1180.    known. The column widths by default should be set to the same size.
  1181.    Authors may override this by specifying relative or absolute column
  1182.    widths, using the COL element. The default table width is the space
  1183.    between the current left and right margins, but may be overridden by
  1184.    the WIDTH attribute on the TABLE element, or determined from
  1185.    absolute column widths. To deal with mixtures of absolute and
  1186.    relative column widths, the first step is to allocate space from the
  1187.    table width to columns with absolute widths. After this, the space
  1188.    remaining is divided up between the columns with relative widths. 
  1189.  
  1190.    The table syntax alone is insufficient to guarantee the consistency
  1191.    of attribute values. For instance, the number of columns specified
  1192.    by the COLS attribute may be inconsistent with the number of columns
  1193.    implied by the COL elements. This in turn, may be inconsistent with
  1194.    the number of columns implied by the table cells. A further problem
  1195.    occurs when the columns are too narrow to avoid clipping cell
  1196.    contents. The width of the table as specified by the TABLE element
  1197.  
  1198. Dave Raggett                                                           Page 20
  1199.  
  1200.  
  1201.  
  1202. HTML Tables                                                      25th Oct 1995
  1203.  
  1204.    or COL elements may result in clipping of cell contents. It is
  1205.    recommended that user agents attempt to recover gracefully from
  1206.    these situations, e.g. by hyphenating words and resorting to
  1207.    splitting words if hyphenation points are unknown. 
  1208.  
  1209. Autolayout Algorithm
  1210.  
  1211.    If the COLS attribute is missing from the table start tag, then the
  1212.    user agent should use the following autolayout algorithm. It uses
  1213.    two passes through the table data and scales linearly with the size
  1214.    of the table. 
  1215.  
  1216.    In the first pass, line wrapping is disabled, and the user agent
  1217.    keeps track of the minimum and maximum width of each cell. The
  1218.    maximum width is given by the widest line. As line wrap has been
  1219.    disabled, paragraphs are treated as long lines unless broken by <BR>
  1220.    elements. The minimum width is given by the widest word or image
  1221.    etc. taking into account leading indents and list bullets etc. In
  1222.    other words, if you were to format the cell's content in a window of
  1223.    its own, determine the minimum width you could make the window
  1224.    before things begin to be clipped. 
  1225.  
  1226.    To cope with character alignment of cell contents, the algorithm
  1227.    keeps three running min/max totals for each column: Left of align
  1228.    char, right of align char and un-aligned. The minimum width for a
  1229.    column is then: max(min_left + min_right, min_non-aligned). 
  1230.  
  1231.    The minimum and maximum cell widths are then used to determine the
  1232.    corresponding minimum and maximum widths for the columns. These in
  1233.    turn, are used to find the minimum and maximum width for the table.
  1234.    Note that cells can contain nested tables, but this doesn't
  1235.    complicate the code significantly. The next step is to assign column
  1236.    widths according to the current window size (more accurately - the
  1237.    width between the left and right margins). 
  1238.  
  1239.    For cells which span multiple columns, a simple approach, as used by
  1240.    Arena, is to evenly apportion the min/max widths to each of the
  1241.    constituent columns. A slightly more complex approach is to use the
  1242.    min/max widths of unspanned cells to weight how spanned widths are
  1243.    apportioned. Experimental study suggests a blend of the two
  1244.    approaches will give good results for a wide range of tables. 
  1245.  
  1246.    The table borders and intercell margins need to be included in
  1247.    assigning column widths. There are three cases: 
  1248.  
  1249.    1.  The minimum table width is equal to or wider than the available
  1250.        space. In this case, assign the minimum widths and allow the
  1251.        user to scroll horizontally. For conversion to braille, it will
  1252.        be necessary to replace the cells by references to notes
  1253.        containing their full content. By convention these appear before
  1254.        the table. 
  1255.  
  1256.    2.  The maximum table width fits within the available space. In this
  1257.  
  1258. Dave Raggett                                                           Page 21
  1259.  
  1260.  
  1261.  
  1262. HTML Tables                                                      25th Oct 1995
  1263.  
  1264.        case, set the columns to their maximum widths. 
  1265.  
  1266.    3.  The maximum width of the table is greater than the available
  1267.        space, but the minimum table width is smaller. In this case,
  1268.        find the difference between the available space and the minimum
  1269.        table width, lets call it W. Lets also call D the difference
  1270.        between maximum and minimum width of the table. 
  1271.  
  1272.        For each column, let d be the the difference between maximum and
  1273.        minimum width of that column. Now set the column's width to the
  1274.        minimum width plus d times W over D. This makes columns with
  1275.        lots of text wider than columns with smaller amounts. 
  1276.  
  1277.    This assignment step is then repeated for nested tables. In this
  1278.    case, the width of the enclosing table's cell plays the role of the
  1279.    current window size in the above description. This process is
  1280.    repeated recursively for all nested tables. 
  1281.  
  1282.    If the table width is specified with the WIDTH attribute, the user
  1283.    agent attempts to set column widths to match. The WIDTH attribute is
  1284.    not binding if this results in columns having less than their
  1285.    minimum widths. 
  1286.  
  1287.    If relative widths are specified with the COL element, the algorithm
  1288.    is modified to increase column widths over the minimum width to meet
  1289.    the relative width constraints. The COL elements should be taken as
  1290.    hints only, so columns shouldn't be set to less than their minimum
  1291.    width. Similarly, columns shouldn't be made so wide that the table
  1292.    stretches well beyond the extent of the window. If a COL element
  1293.    specifies a relative width of zero, the column should always be set
  1294.    to its minimum width. 
  1295.  
  1296. ------------------------------------------------------------------------------
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318. Dave Raggett                                                           Page 22
  1319.  
  1320.  
  1321.  
  1322. HTML Tables                                                      25th Oct 1995
  1323.  
  1324. HTML Table DTD
  1325.  
  1326.    The DTD or document type definition provides the formal definition
  1327.    of the allowed syntax for HTML tables. 
  1328.  
  1329.    <!-- Content model entities imported from parent DTD:
  1330.    
  1331.      %body.content; allows table cells to contain headers, paras,
  1332.      lists, form elements and even arbitrarily nested tables.
  1333.    
  1334.      %text; is text characters, including character entities and
  1335.      character emphasis elements, IMG and anchors
  1336.    -->
  1337.    
  1338.    <!ENTITY % attrs
  1339.           "id      ID       #IMPLIED  -- element identifier --
  1340.            class   NAMES    #IMPLIED  -- for subclassing elements --
  1341.            style   CDATA    #IMPLIED  -- rendering annotation --
  1342.            lang    NAME     #IMPLIED  -- as per RFC 1766 --
  1343.            dir   (ltr|rtl)  #IMPLIED  -- I18N text direction --">
  1344.    
  1345.    <!--
  1346.     The BORDER attribute sets the thickness of the frame around the
  1347.     table. The default units are screen pixels.
  1348.    
  1349.     The FRAME attribute specifies which parts of the frame around
  1350.     the table should be rendered. The values are not the same as
  1351.     CALS to avoid a name clash with the VALIGN attribute.
  1352.    
  1353.     The value "border" is included for backwards compatibility with
  1354.     <TABLE BORDER> which yields frame=border and border=implied
  1355.     For <TABLE BORDER=1> you get border=1 and frame=implied. In this
  1356.     case, its appropriate to treat this as frame=border for backwards
  1357.     compatibility with deployed browsers.
  1358.    -->
  1359.    
  1360.    <!ENTITY % Frame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
  1361.    
  1362.    <!--
  1363.     The RULES attribute defines which rules to draw between cells:
  1364.    
  1365.     If RULES is absent then assume:
  1366.         "none" if BORDER is absent or BORDER=0 otherwise "all"
  1367.    -->
  1368.    
  1369.    <!ENTITY % Rules "(none | basic | rows | cols | all)">
  1370.            
  1371.    <!-- horizontal placement of table relative to window -->
  1372.    <!ENTITY % Where "(left|center|right)">
  1373.    
  1374.  
  1375.  
  1376.  
  1377.  
  1378. Dave Raggett                                                           Page 23
  1379.  
  1380.  
  1381.  
  1382. HTML Tables                                                      25th Oct 1995
  1383.  
  1384.    <!-- horizontal alignment attributes for cell contents -->
  1385.    <!ENTITY % cell.halign
  1386.            "align  (left|center|right|justify|char) #IMPLIED
  1387.             char    CDATA   #IMPLIED -- alignment char, e.g. char=':' --
  1388.             charoff NUTOKEN 50       -- % offset for alignment char --"
  1389.            >
  1390.    
  1391.    <!-- vertical alignment attributes for cell contents -->
  1392.    <!ENTITY % cell.valign
  1393.            "valign  (top|middle|bottom|baseline)  #IMPLIED"
  1394.            >
  1395.    
  1396.    <!ELEMENT table - - (caption?, (col|colgroup)*, thead?, tfoot?, tbody+)>
  1397.    <!ELEMENT caption - - (%text;)+>
  1398.    <!ELEMENT thead - O (tr+)>
  1399.    <!ELEMENT tfoot - O (tr+)>
  1400.    <!ELEMENT tbody O O (tr+)>
  1401.    <!ELEMENT col - O EMPTY>
  1402.    <!ELEMENT tr - O (th|td)+>
  1403.    <!ELEMENT (th|td) - O %body.content>
  1404.    
  1405.    <!ATTLIST table                    -- table element --
  1406.            %attrs;                    -- id, lang, style, dir and class --
  1407.            align   %Where;  #IMPLIED  -- table position relative to window --
  1408.            width   CDATA    #IMPLIED  -- table width relative to window --
  1409.            cols    NUMBER   #IMPLIED  -- used for immediate display mode --
  1410.            border  CDATA    #IMPLIED  -- controls frame width around table --
  1411.            frame   %Frame;  #IMPLIED  -- which parts of table frame to include --
  1412.            rules   %Rules;  #IMPLIED  -- rulings between rows and cols --
  1413.            cellspacing CDATA #IMPLIED -- spacing between cells --
  1414.            cellpadding CDATA #IMPLIED -- spacing within cells --
  1415.            >
  1416.    
  1417.    <!-- ALIGN is used here for compatibility with deployed browsers -->
  1418.    <!ENTITY % Caption "(top|bottom|left|right)">
  1419.    
  1420.    <!ATTLIST caption                  -- table caption --
  1421.            %attrs;                    -- id, lang, style, dir and class --
  1422.            align  %Caption; #IMPLIED  -- relative to table --
  1423.            >
  1424.    
  1425.    <!--
  1426.    COLGROUP groups a set of COL elements. It allows you to group
  1427.    several columns together. COL elements contained within a COLGROUP
  1428.    element do not themselves define column groups.
  1429.    -->
  1430.    
  1431.    <!ELEMENT colgroup - O (col+)>
  1432.    <!ATTLIST colgroup
  1433.            %attrs;                    -- id, lang, style, dir and class --
  1434.            %cell.halign;              -- horizontal alignment in cells --
  1435.            %cell.valign;              -- vertical alignment in cells --
  1436.            >
  1437.  
  1438. Dave Raggett                                                           Page 24
  1439.  
  1440.  
  1441.  
  1442. HTML Tables                                                      25th Oct 1995
  1443.  
  1444.    
  1445.    <!--
  1446.     COL elements define the alignment properties for cells in a given
  1447.     column or spanned columns. The WIDTH attribute specifies the
  1448.     width of the columns, e.g.
  1449.    
  1450.         width=64        width in screen pixels
  1451.         width=0.5*      relative width of 0.5
  1452.    -->
  1453.    
  1454.    <!ATTLIST col                      -- column groups and properties --
  1455.            %attrs;                    -- id, lang, style, dir and class --
  1456.            span    NUMBER   1         -- number of columns spanned by group --
  1457.            width   CDATA    #IMPLIED  -- relative width e.g. 2.5 --
  1458.            %cell.halign;              -- horizontal alignment in cells --
  1459.            %cell.valign;              -- vertical alignment in cells --
  1460.            >
  1461.    
  1462.    <!--
  1463.        Use THEAD to duplicate headers when breaking table
  1464.        across page boundaries, or for static headers when
  1465.        body sections are rendered in scrolling panel.
  1466.    
  1467.        Use TFOOT to duplicate footers when breaking table
  1468.        across page boundaries, or for static footers when
  1469.        body sections are rendered in scrolling panel.
  1470.    
  1471.        Use multiple TBODY sections when rules are needed
  1472.        between groups of table rows.
  1473.    -->
  1474.    <!ATTLIST (thead|tbody|tfoot)      -- table section --
  1475.            %attrs;                    -- id, lang, style, dir and class --
  1476.            %cell.halign;              -- horizontal alignment in cells --
  1477.            %cell.valign;              -- vertical alignment in cells --
  1478.            >
  1479.    
  1480.    <!ATTLIST tr                       -- table row --
  1481.            %attrs;                    -- id, lang, style, dir and class --
  1482.            %cell.halign;              -- horizontal alignment in cells --
  1483.            %cell.valign;              -- vertical alignment in cells --
  1484.            >
  1485.    
  1486.    <!ATTLIST (th|td)                  -- header or data cell --
  1487.            %attrs;                    -- id, lang, style, dir and class --
  1488.            axis    CDATA    #IMPLIED  -- defaults to cell content --
  1489.            axes    CDATA    #IMPLIED  -- list of axis names --
  1490.            nowrap (nowrap)  #IMPLIED  -- suppress word wrap --
  1491.            rowspan NUMBER   1         -- number of rows spanned by cell --
  1492.            colspan NUMBER   1         -- number of cols spanned by cell --
  1493.            %cell.halign;              -- horizontal alignment in cells --
  1494.            %cell.valign;              -- vertical alignment in cells --
  1495.            >
  1496.  
  1497.  
  1498. Dave Raggett                                                           Page 25
  1499.  
  1500.  
  1501.  
  1502. HTML Tables                                                      25th Oct 1995
  1503.  
  1504. ------------------------------------------------------------------------------
  1505. References
  1506.  
  1507.    Arena 
  1508.        W3C's HTML3 browser, see "http://www.w3.org/pub/WWW/Arena/".
  1509.        Arena was originally created as a proof of concept demo for
  1510.        ideas in the HTML+ specification that preceded HTML3. The
  1511.        browser is now being re-implemented to provide a reference
  1512.        implementation of HTML3 along with support for style sheets and
  1513.        client-side scripting. 
  1514.  
  1515.    CALS 
  1516.        Continuous Acquisition and Life-Cycle Support (formerly
  1517.        Computer-aided Acquisition and Logistics Support) (CALS) is a
  1518.        Department of Defense (DoD) strategy for achieving effective
  1519.        creation, exchange, and use of digital data for weapon systems
  1520.        and equipment. More information can be found from the US Navy
  1521.        CALS home page at http://navysgml.dt.navy.mil/cals.html
  1522.        
  1523.  
  1524.    HTML 3.0 
  1525.        HyperText Markup Language Specification Version 3.0. This is the
  1526.        initial draft specification as published in March 1995. Work on
  1527.        refining HTML3 is proceeding piecemeal with the new table
  1528.        specification as one of the pieces. For W3C related work on
  1529.        HTML, see "http://www.w3.org/pub/WWW/MarkUp/". 
  1530.  
  1531.    RFC 1766 
  1532.        "Tags for the Identification of Languages", by H. Alvestrand,
  1533.        UNINETT, March 1995. This document can be downloaded from
  1534.        "ftp://ds.internic.net/rfc/rfc1766.txt". 
  1535.  
  1536. ------------------------------------------------------------------------------
  1537.     The World Wide Web Consortium:
  1538.    http://www.w3.org/pub/WWW/Consortium/ 
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558. Dave Raggett                                                           Page 26
  1559.  
  1560.